* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    will-change: transform, opacity, backdrop-filter;
    transform: translateZ(0);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #111;
    color: #eee;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    contain: layout style paint;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.stretched-header {
    text-align: center;
    margin-bottom: 15px;
    font-size: clamp(18px, 5vw, 24px);
    transform: scaleX(5);
    transform-origin: center;
    letter-spacing: -3px;
    color: #4CAF50;
    width: 180px; 
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.beta-tag {
    position: absolute;
    top: -5px;
    right: -35px;
    background-color: #ff5722;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    transform: scaleX(0.2);
    font-weight: bold;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    background-color: #222;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    contain: layout style paint;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.emoji-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

#emoji-input {
    width: 70px;
    height: 50px;
    font-size: 2rem;
    text-align: center;
    border: none;
    border-radius: 10px;
    background-color: #333;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

#emoji-input:hover, #emoji-input:focus {
    background-color: #444;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.picker-button {
    height: 50px;
    width: 50px;
    font-size: 1.5rem;
    background-color: #333;
    color: #4CAF50;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.picker-button:hover {
    background-color: #444;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.control-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #4CAF50;
}

.width-control, .slice-control {
    position: relative;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: #333;
    outline: none;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: #45a049;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
    transform: scale(1.1);
}

.slider::-moz-range-thumb:hover {
    background: #45a049;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
    transform: scale(1.1);
}

.canvas-container {
    background-color: #222;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    contain: layout style paint;
    transform: translateZ(0);
    backface-visibility: hidden;
}

#emoji-canvas {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 0 auto;
    display: block;
    background-color: #333;
    border-radius: 8px;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

button {
    padding: 10px 15px;
    font-size: 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.emoji-categories {
    background-color: #222;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    contain: layout style paint;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.category-tab {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: #333;
    color: #ddd;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: auto;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.category-tab.active {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.category-tab:hover:not(.active) {
    background-color: #444;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255,255,255,0.1);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 8px;
}

.emoji-grid-item {
    font-size: 1.8rem;
    background-color: #333;
    border: none;
    border-radius: 50%;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: auto;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.emoji-grid-item:hover {
    background-color: #444;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Tooltip for feedback */
.tooltip {
    position: fixed;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Adding styles for secret category */
.category-tab:nth-last-child(1) {
    background-color: #222;
    color: #888;
    border: 1px dashed #555;
}

.category-tab:nth-last-child(1).active {
    background-color: #333;
    color: #ddd;
    border: 1px solid #777;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

/* AI Emoji Generator styling */
.ai-generator {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}
.ai-generator input {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    background-color: rgba(255,255,255,0.1);
    color: #eee;
}
.ai-generator button {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    background-color: #4CAF50;
    color: #fff;
    border: none;
    transition: background-color 0.2s;
}
.ai-generator button:hover {
    background-color: #45A049;
}

/* Exclusive emoji image styling */
.exclusive-emoji {
    width: 40px;
    height: auto;
    display: block;
    margin: 0 auto;
}

emoji-picker {
    --background: #222;
    --border-color: #444;
    --indicator-color: #4CAF50;
    --input-border-color: #444;
    --input-font-color: #eee;
    --input-placeholder-color: #888;
    --outline-color: #4CAF50;
    --category-font-color: #eee;
    --button-hover-background: #444;
    --button-active-background: #4CAF50;
}

.effects-control {
    background-color: #222;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    display: block; 
    contain: layout style paint;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.effect-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.effect-button {
    padding: 10px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.effect-button.reset-btn {
    background-color: #ff5722;
}

.effect-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.effect-button:active {
    transform: translateY(0);
}

/* Advanced Glass Modes */
.glass-liquid {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.15) 100%) !important;
    backdrop-filter: blur(20px) saturate(180%) hue-rotate(10deg) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.05) !important;
    animation: liquidFlow 8s ease-in-out infinite;
}

.glass-realistic {
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
    backdrop-filter: blur(16px) contrast(120%) brightness(110%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
    position: relative;
}

.glass-realistic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 30%);
    border-radius: inherit;
    pointer-events: none;
}

.glass-aero {
    background: 
        linear-gradient(45deg, rgba(76, 175, 80, 0.15) 0%, rgba(76, 175, 80, 0.08) 100%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
    backdrop-filter: blur(18px) saturate(150%) hue-rotate(5deg) !important;
    border: 1px solid rgba(76, 175, 80, 0.2) !important;
    box-shadow: 
        0 10px 35px rgba(76, 175, 80, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 20px rgba(76, 175, 80, 0.1) !important;
}

/* Advanced animations */
@keyframes liquidFlow {
    0%, 100% { 
        backdrop-filter: blur(20px) saturate(180%) hue-rotate(0deg);
        transform: translateZ(0) rotateX(0deg);
    }
    25% { 
        backdrop-filter: blur(22px) saturate(200%) hue-rotate(5deg);
        transform: translateZ(0) rotateX(0.5deg);
    }
    50% { 
        backdrop-filter: blur(18px) saturate(160%) hue-rotate(10deg);
        transform: translateZ(0) rotateX(1deg);
    }
    75% { 
        backdrop-filter: blur(24px) saturate(220%) hue-rotate(15deg);
        transform: translateZ(0) rotateX(0.5deg);
    }
}

@keyframes chromaticAberration {
    0% { filter: hue-rotate(0deg) saturate(100%); }
    33% { filter: hue-rotate(2deg) saturate(120%); }
    66% { filter: hue-rotate(-2deg) saturate(110%); }
    100% { filter: hue-rotate(0deg) saturate(100%); }
}

@keyframes causticPattern {
    0% { 
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.05);
    }
    50% { 
        box-shadow: 
            0 12px 40px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1),
            inset 0 0 20px rgba(255, 255, 255, 0.05);
    }
    100% { 
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.05);
    }
}

/* Enhanced button effects */
.glass-button-liquid {
    position: relative;
    overflow: hidden;
    animation: liquidFlow 6s ease-in-out infinite;
}

.glass-button-liquid::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 10px;
    }
    
    .stretched-header {
        display: none;
    }
    
    .controls {
        padding: 15px;
    }
    
    .canvas-container {
        padding: 10px;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        max-width: 300px;
    }
    
    .category-tabs {
        gap: 5px;
    }
    
    .category-tab {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }
    
    .glass-liquid,
    .glass-realistic,
    .glass-aero {
        backdrop-filter: blur(12px) !important;
        animation: none !important;
    }
    
    .glass-button-liquid::after {
        display: none;
    }
}

/* High-end device enhancements */
@media (min-width: 1920px) and (min-height: 1080px) {
    .glass-liquid {
        backdrop-filter: blur(25px) saturate(200%) hue-rotate(15deg) !important;
        animation: liquidFlow 6s ease-in-out infinite, chromaticAberration 4s ease-in-out infinite;
    }
    
    .glass-realistic {
        backdrop-filter: blur(20px) contrast(130%) brightness(115%) !important;
        animation: causticPattern 5s ease-in-out infinite;
    }
    
    .glass-aero {
        backdrop-filter: blur(22px) saturate(180%) hue-rotate(8deg) !important;
        box-shadow: 
            0 15px 50px rgba(76, 175, 80, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.35),
            0 0 30px rgba(76, 175, 80, 0.15) !important;
    }
}

/* Enhanced interaction states */
.glass-liquid:hover,
.glass-realistic:hover,
.glass-aero:hover {
    transform: translateY(-3px) translateZ(0);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-liquid:hover {
    backdrop-filter: blur(25px) saturate(220%) hue-rotate(20deg) !important;
    box-shadow: 
        0 15px 50px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(255, 255, 255, 0.1) !important;
}

.glass-realistic:hover {
    backdrop-filter: blur(20px) contrast(140%) brightness(120%) !important;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15) !important;
}

.glass-aero:hover {
    backdrop-filter: blur(22px) saturate(200%) hue-rotate(10deg) !important;
    box-shadow: 
        0 18px 60px rgba(76, 175, 80, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 40px rgba(76, 175, 80, 0.2) !important;
}

/* New announcement banner styles */
.announcement-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to right, #fdde5c, #f8ab5e, #f26586, #4361ee, #4cc9f0);
    color: #111;
    text-align: center;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    font-size: 1.3rem;
    z-index: 10000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeSlideDown 1s ease-out, pulsate 2s ease-in-out infinite alternate;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.announcement-banner div {
    flex: 1;
    text-align: center;
}

.announcement-banner {
    padding: 20px;
    font-size: 1.3rem;
}

/* Spin & Rainbow Canvas Effects */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rainbow-filters { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }

#emoji-canvas.spin-canvas { animation: spin 4s linear infinite; }
#emoji-canvas.rainbow-canvas { animation: rainbow-filters 5s linear infinite; }

/* Bounce Canvas Effect */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
}
#emoji-canvas.bounce-canvas {
  animation: bounce 2s ease infinite;
}

/* Wiggle Canvas Effect */
@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
#emoji-canvas.wiggle-canvas {
  animation: wiggle 1.5s ease-in-out infinite;
}

/* Shake Canvas Effect */
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(5px); }
  50% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
  100% { transform: translateX(0); }
}
#emoji-canvas.shake-canvas {
  animation: shake 0.5s ease-in-out infinite;
}

/* Flip Canvas Effect */
@keyframes flip {
  0% { transform: perspective(400px) rotateY(0deg); }
  50% { transform: perspective(400px) rotateY(180deg); }
  100% { transform: perspective(400px) rotateY(0deg); }
}
#emoji-canvas.flip-canvas {
  transform-style: preserve-3d;
  animation: flip 3s ease-in-out infinite;
}

/* Jello Canvas Effect */
@keyframes jello {
  0% { transform: scaleX(1) scaleY(1); }
  30% { transform: scaleX(1.25) scaleY(0.75); }
  40% { transform: scaleX(0.75) scaleY(1.25); }
  50% { transform: scaleX(1.15) scaleY(0.85); }
  65% { transform: scaleX(0.95) scaleY(1.05); }
  75% { transform: scaleX(1.05) scaleY(0.95); }
  100% { transform: scaleX(1) scaleY(1); }
}
#emoji-canvas.jello-canvas {
  animation: jello 0.8s ease-in-out infinite;
}

/* Ensure UI controls and panels stay above animated canvas */
.controls,
.effects-control,
.actions,
.emoji-categories {
    position: relative;
    z-index: 10;
}

/* Canvas container sits just beneath the controls */
.canvas-container {
    position: relative;
    z-index: 1;
}

/* When any canvas effect is active, let clicks pass through the canvas itself */
#emoji-canvas.spin-canvas,
#emoji-canvas.rainbow-canvas,
#emoji-canvas.bounce-canvas,
#emoji-canvas.wiggle-canvas,
#emoji-canvas.shake-canvas,
#emoji-canvas.flip-canvas,
#emoji-canvas.jello-canvas {
    /* ensure controls remain clickable even when effects are on */
    pointer-events: auto !important;
}

/* Evil Mode */
body.evil-mode { filter: invert(1) hue-rotate(180deg) saturate(200%) brightness(0.8); }
body.evil-mode #emoji-canvas { border: 3px solid red !important; }
body.evil-mode .container,
body.evil-mode .controls,
body.evil-mode button,
body.evil-mode .picker-button { 
    background: rgba(80,0,0,0.6) !important; 
    border-color: red !important; 
    color: #faa !important; 
}

/* Oldest Mode */
body.oldest-mode { filter: grayscale(100%) sepia(100%) contrast(150%); }
body.oldest-mode #emoji-canvas { border: 2px dashed #999 !important; }
body.oldest-mode .controls,
body.oldest-mode .actions { display: none !important; }
body.oldest-mode .exit-oldest-button { display: inline-block !important; }

/* Locked/unlocked exclusive emoji styling */
.emoji-grid-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
}
.emoji-grid-item.unlocked {
    opacity: 1;
    cursor: pointer;
}

/* Poll section styles */
.poll-section {
    background-color: rgba(34,34,34,0.85);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.poll-section h2 {
    color: #4CAF50;
    margin-bottom: 10px;
}
#poll-form label {
    display: inline-block;
    margin-right: 10px;
    cursor: pointer;
    color: #ddd;
}
#poll-form input[type="radio"] {
    margin-right: 4px;
}
#poll-vote {
    margin-top: 10px;
    background-color: #4CAF50;
    color: white;
}
#poll-results .poll-bar {
    position: relative;
    background: #444;
    border-radius: 4px;
    margin-top: 8px;
    padding: 4px 8px;
    color: #eee;
}
#poll-results .poll-bar-inner {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #4CAF50;
    border-radius: 4px;
    z-index: -1;
}

/* Comment section styles */
.comment-section {
    background-color: rgba(34,34,34,0.85);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.comment-section h2 {
    color: #4CAF50;
    margin-bottom: 10px;
}
#chat-messages {
    max-height: 240px;
    overflow-y: auto;
    background: #222;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}
.chat-message {
    margin: 6px 0;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}
.chat-message.user {
    align-self: flex-end;
    background: #4CAF50;
    color: #111;
}
.chat-message.assistant {
    align-self: flex-start;
    background: #333;
    color: #eee;
}
.chat-input-group {
    display: flex;
    gap: 8px;
}
#chat-input {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: #333;
    color: #eee;
}
#chat-send {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
}